package vue;

import java.util.ArrayList;
import java.util.HashMap;

import javax.swing.JButton;

import model.Cellule;
import model.Coordonnee;

import controleur.Template;

public class TemplateButton extends JButton{
	private static final long serialVersionUID = 1L;
	ArrayList<HashMap<Coordonnee, Cellule>> aMap = new ArrayList<HashMap<Coordonnee,Cellule>>();
	ArrayList<String> aNom = new ArrayList<String>();
	@SuppressWarnings("unchecked")
	public TemplateButton() {
		super("Gabarit");
		/**
		 * Création d’un template de test
		 */
		HashMap<Coordonnee, Cellule> map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(0, 1, 10), new Cellule(
				new Coordonnee(0, 1, 10)));
		map.put(new Coordonnee(1, 1, 10), new Cellule(
				new Coordonnee(1, 1, 10)));
		map.put(new Coordonnee(2, 1, 10), new Cellule(
				new Coordonnee(2, 1, 10)));
		map.put(new Coordonnee(3, 1, 10), new Cellule(
				new Coordonnee(3, 1, 10)));
		map.put(new Coordonnee(4, 1, 10), new Cellule(
				new Coordonnee(4, 1, 10)));
		map.put(new Coordonnee(5, 1, 10), new Cellule(
				new Coordonnee(5, 1, 10)));
		map.put(new Coordonnee(6, 1, 10), new Cellule(
				new Coordonnee(6, 1, 10)));
		map.put(new Coordonnee(7, 1, 10), new Cellule(
				new Coordonnee(7, 1, 10)));
		map.put(new Coordonnee(8, 1, 10), new Cellule(
				new Coordonnee(8, 1, 10)));
		map.put(new Coordonnee(9, 1, 10), new Cellule(
				new Coordonnee(9, 1, 10)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Ligne 10");
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(0, 2, 2), new Cellule(
				new Coordonnee(0, 2, 2)));
		map.put(new Coordonnee(1, 2, 2), new Cellule(
				new Coordonnee(1, 2, 2)));
		map.put(new Coordonnee(2, 2, 2), new Cellule(
				new Coordonnee(2, 2, 2)));
		map.put(new Coordonnee(3, 2, 2), new Cellule(
				new Coordonnee(3, 2, 2)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Bloc");
		
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(1, 2, 4), new Cellule(
				new Coordonnee(1, 2, 4)));
		map.put(new Coordonnee(2, 2, 4), new Cellule(
				new Coordonnee(2, 2, 4)));
		map.put(new Coordonnee(3, 2, 4), new Cellule(
				new Coordonnee(3, 2, 4)));
		map.put(new Coordonnee(4, 2, 4), new Cellule(
				new Coordonnee(4, 2, 4)));
		map.put(new Coordonnee(5, 2, 4), new Cellule(
				new Coordonnee(5, 2, 4)));
		map.put(new Coordonnee(6, 2, 4), new Cellule(
				new Coordonnee(6, 2, 4)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Grenouille");
		
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(1, 3, 3), new Cellule(
				new Coordonnee(1, 3, 3)));
		map.put(new Coordonnee(5, 3, 3), new Cellule(
				new Coordonnee(5, 3, 3)));
		map.put(new Coordonnee(6, 3, 3), new Cellule(
				new Coordonnee(6, 3, 3)));		
		map.put(new Coordonnee(7, 3, 3), new Cellule(
				new Coordonnee(7, 3, 3)));
		map.put(new Coordonnee(8, 3, 3), new Cellule(
				new Coordonnee(8, 3, 3)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Planeur");
		
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(0, 3, 3), new Cellule(
				new Coordonnee(0, 3, 3)));
		map.put(new Coordonnee(1, 3, 3), new Cellule(
				new Coordonnee(1, 3, 3)));
		map.put(new Coordonnee(2, 3, 3), new Cellule(
				new Coordonnee(2, 3, 3)));
		map.put(new Coordonnee(3, 3, 3), new Cellule(
				new Coordonnee(3, 3, 3)));		
		map.put(new Coordonnee(5, 3, 3), new Cellule(
				new Coordonnee(5, 3, 3)));
		map.put(new Coordonnee(6, 3, 3), new Cellule(
				new Coordonnee(6, 3, 3)));
		map.put(new Coordonnee(8, 3, 3), new Cellule(
				new Coordonnee(8, 3, 3)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Pi Heptomino");
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(1, 4, 4), new Cellule(
				new Coordonnee(1, 4, 4)));
		map.put(new Coordonnee(6, 4, 4), new Cellule(
				new Coordonnee(6, 4, 4)));
		map.put(new Coordonnee(7, 4, 4), new Cellule(
				new Coordonnee(7, 4, 4)));
		map.put(new Coordonnee(8, 4, 4), new Cellule(
				new Coordonnee(8, 4, 4)));
		map.put(new Coordonnee(9, 4, 4), new Cellule(
				new Coordonnee(9, 4, 4)));
		map.put(new Coordonnee(14, 4, 4), new Cellule(
				new Coordonnee(14, 4, 4)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Oscilateur 1");
		
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(1, 3, 3), new Cellule(
				new Coordonnee(1, 3, 3)));
		map.put(new Coordonnee(3, 3, 3), new Cellule(
				new Coordonnee(3, 3, 3)));
		map.put(new Coordonnee(4, 3, 3), new Cellule(
				new Coordonnee(4, 3, 3)));
		map.put(new Coordonnee(5, 3, 3), new Cellule(
				new Coordonnee(5, 3, 3)));
		map.put(new Coordonnee(7, 3, 3), new Cellule(
				new Coordonnee(7, 3, 3)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Oscilateur 2");
		
		map = new HashMap<Coordonnee, Cellule>();
		map.put(new Coordonnee(3, 4, 5), new Cellule(
				new Coordonnee(3, 4, 5)));
		map.put(new Coordonnee(9, 4, 5), new Cellule(
				new Coordonnee(9, 4, 5)));
		map.put(new Coordonnee(10, 4, 5), new Cellule(
				new Coordonnee(10, 4, 5)));
		map.put(new Coordonnee(14, 4, 5), new Cellule(
				new Coordonnee(14, 4, 5)));
		map.put(new Coordonnee(16, 4, 5), new Cellule(
				new Coordonnee(16, 4, 5)));
		map.put(new Coordonnee(17, 4, 5), new Cellule(
				new Coordonnee(17, 4, 5)));
		map.put(new Coordonnee(18, 4, 5), new Cellule(
				new Coordonnee(18, 4, 5)));
		map.put(new Coordonnee(19, 4, 5), new Cellule(
				new Coordonnee(19, 4, 5)));
		aMap.add((HashMap<Coordonnee, Cellule>) map.clone());
		aNom.add("Vaiseau");
		
		addMouseListener(new Template(aMap, aNom));
	}
	

}
